/*********************************
File name:  study2_analyses Final.do
PURPOSE:    This do file is for analyzing "ideological identity"
            among rightists and leftists:			
INPUT: 		study2_COMPLETE_dataset.dta 
*********************************/

* Changing the working directory
cd "C:\Users\bronc\Desktop"

* Load data (.dta)
use "study2_COMPLETE_dataset.dta"



*****************************************
*** Table 2 - Political participation ***
*****************************************

*** Updated Table 2 (all issues aligned) ***

* Model 1 - Intention to vote in the next election
ologit intent_to_vote II_scale partisan_identity issues_aligned econ_aligned  ///
halacha_aligned age female relig_01 educ_01, r
outreg2 using Table2.doc, replace se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

* Calculating the predicted probabilities for a respondent in Model 1
margin, atmeans at(II_scale= (0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1)) predict(outcome(4))

* 'dominance' analyses
domin intent_to_vote II_scale partisan_identity issues_aligned econ_aligned ///
halacha_aligned age female relig_01 educ_01, reg(ologit) fitstat(e(r2_p)) 


* Model 2 -  Political discussion with family and friends
ologit polit_dis II_scale partisan_identity issues_aligned econ_aligned  ///
halacha_aligned age female relig_01 educ_01, r
outreg2 using Table2.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

/*
* Calculating the predicted probabilities for a respondent in Model 2
margin, atmeans at(II_scale= (0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1))
margin, atmeans at(partisan_identity= (0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1))
*/
* 'dominance' analyses
domin polit_dis II_scale partisan_identity issues_aligned econ_aligned ///
halacha_aligned age female relig_01 educ_01, reg(ologit) fitstat(e(r2_p)) 


* Model 3 - Online political participation
reg online_part II_scale partisan_identity issues_aligned econ_aligned  ///
halacha_aligned age female relig_01 educ_01, r
outreg2 using Table2.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

/*
* Calculating the predicted probabilities for a respondent in Model 3
margin, atmeans at(II_scale= (0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1))
margin, atmeans at(partisan_identity= (0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1))
*/
* 'dominance' analyses
domin online_part II_scale partisan_identity issues_aligned econ_aligned ///
halacha_aligned age female relig_01 educ_01, reg(regress) fitstat(e(r2)) 




*** Experiemental results ***
ttest anger, by (status_threat)
esize twosample anger, by (status_threat)
ttest anger, by (issue_threat)
esize twosample anger, by (issue_threat)

ttest concern, by (status_threat)
esize twosample concern, by (status_threat)
ttest concern, by (issue_threat)
esize twosample concern, by (issue_threat)

ttest enthusiasm, by (status_threat)
esize twosample enthusiasm, by (status_threat)
ttest enthusiasm, by (issue_threat)
esize twosample enthusiasm, by (issue_threat)



***************************************
*** Analyses in the Online Appendix ***
***************************************

*** Table D1 - Voting results (similar to Models 1-2 in Table 1 [main text])

*** Model 1 - Predicting In-bloc voteing for Right-wing respondents
logit inbloc_vote II_scale issues_aligned econ_aligned halacha_aligned ///
age female relig_01 educ_01 if bloc_num==2, r
outreg2 using Table_D1.doc, replace se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) addstat(Pseudo R-squared, `e(r2_p)')

/*
* Calculating and graphing the predicted probabilities for a respondent in Model 1
margin, atmeans at(II_scale= (0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1))
marhis II_scale, points (10) atmeans percent
*/

*** Model 2 - Predicting In-bloc voteing for left-wing respondents
logit inbloc_vote II_scale issues_aligned econ_aligned halacha_aligned ///
age female relig_01 educ_01 if bloc_num==1, r
outreg2 using Table_D1.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) addstat(Pseudo R-squared, `e(r2_p)')

* Calculating and graphing the predicted probabilities for a respondent in Model 2
margin, atmeans at(II_scale= (0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1))
*marhis II_scale, points (10) atmeans percent



*** Table D3 - includes models w/o AIG, w/o alligned issues ***

*** Model 1 - Predicting In-bloc voteing for Right-wing respondents (no AIG)
logit inbloc_vote issues_aligned econ_aligned halacha_aligned ///
age female relig_01 educ_01 if bloc_num==2, r
outreg2 using Table_D3.doc, replace se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) addstat(Pseudo R-squared, `e(r2_p)')

*** Model 2 - Predicting In-bloc voteing for Right-wing respondents (no issues)
logit inbloc_vote II_scale econ_aligned halacha_aligned ///
age female relig_01 educ_01 if bloc_num==2, r
outreg2 using Table_D3.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) addstat(Pseudo R-squared, `e(r2_p)')

*** Model 3 - Predicting In-bloc voteing for Right-wing respondents (both AIG and issues)
logit inbloc_vote II_scale issues_aligned econ_aligned halacha_aligned ///
age female relig_01 educ_01 if bloc_num==2, r
outreg2 using Table_D3.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) addstat(Pseudo R-squared, `e(r2_p)')

*** Model 4 - Predicting In-bloc voteing for left-wing respondents (no AIG)
logit inbloc_vote issues_aligned econ_aligned halacha_aligned ///
age female relig_01 educ_01 if bloc_num==1, r
outreg2 using Table_D3.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) addstat(Pseudo R-squared, `e(r2_p)')

*** Model 5 - Predicting In-bloc voteing for left-wing respondents (no issues)
logit inbloc_vote II_scale econ_aligned halacha_aligned ///
age female relig_01 educ_01 if bloc_num==1, r
outreg2 using Table_D3.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) addstat(Pseudo R-squared, `e(r2_p)')

*** Model 6 - Predicting In-bloc voteing for left-wing respondents (both AIG and issues)
logit inbloc_vote II_scale issues_aligned econ_aligned halacha_aligned ///
age female relig_01 educ_01 if bloc_num==1, r
outreg2 using Table_D3.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) addstat(Pseudo R-squared, `e(r2_p)')



*** Table D4 - Table 2 w. an interaction b/w right-wing and Ideological-Identity scale

* Model 1 - Intention to vote in the next election
ologit intent_to_vote c.II_scale##i.right_bloc partisan_identity issues_aligned ///
econ_aligned halacha_aligned age female relig_01 educ_01, r
outreg2 using Table_D4.doc, replace se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

* Model 2 -  Political discussion with family and friends
ologit polit_dis c.II_scale##i.right_bloc partisan_identity issues_aligned ///
econ_aligned halacha_aligned age female relig_01 educ_01, r
outreg2 using Table_D4.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

* Model 3 - Online political participation
reg online_part c.II_scale##i.right_bloc partisan_identity issues_aligned  ///
econ_aligned halacha_aligned age female relig_01 educ_01, r
outreg2 using Table_D4.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 



*** Table D5 - Table with the three Online Political Participation items ***

* Model 1 - How often wrote political opinions on social media during last week?
ologit q28 II_scale partisan_identity issues_aligned econ_aligned halacha_aligned ///
age female relig_01 educ_01, r
outreg2 using Table_D5.doc, replace se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

* Model 2 - How often shared parties'/politicians' content on social media during last week?
ologit q29 II_scale partisan_identity issues_aligned econ_aligned halacha_aligned ///
age female relig_01 educ_01, r
outreg2 using Table_D5.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

* Model 3 - How often shared others' political content on social media during last week?
ologit q30 II_scale partisan_identity issues_aligned econ_aligned halacha_aligned ///
age female relig_01 educ_01, r
outreg2 using Table_D5.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 



*** Matching (Entropy Balancing) ***

*** Table D6 - Matching analyses for Rightists (continued from Study 1 analyses) ***
sum II_scale if bloc_num==2, d /*median = .53125 */
gen II_right_high=1 if bloc_num==2 & II_scale> .53125
replace II_right_high=0 if bloc_num==2 & II_scale<= .53125
tab II_right_high

ebalance II_right_high partisan_identity issues_aligned econ_aligned halacha_aligned age female relig_01 educ_01, targets(1)
svyset [pweight=_webal]
* Model 4 - Model 1 in Table 2
ologit intent_to_vote i.II_right_high
outreg2 using Table_D6.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

* Model 5 - Model 2 in Table 2
ologit polit_dis i.II_right_high
outreg2 using Table_D6.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

* Model 6 - Model 3 in Table 2
reg online_part i.II_right_high
outreg2 using Table_D6.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 


** Matching for the experiment (result not shown in the main text) **
ebalance II_right_high issues_aligned econ_aligned halacha_aligned age female relig_01 educ_01, targets(1)
svyset [pweight=_webal]

* Anger 
svy: reg anger c.II_right_high##i.status_threat 
svy: reg anger c.II_right_high##i.status_threat c.issues_aligned##i.issue_threat
* Concern
svy: reg concern c.II_right_high##i.status_threat 
svy: reg concern c.II_right_high##i.status_threat c.issues_aligned##i.issue_threat
* Enthusiasm
svy: reg enthusiasm c.II_right_high##i.status_threat 
svy: reg enthusiasm c.II_right_high##i.status_threat c.issues_aligned##i.issue_threat


*** Table D7 - Matching analyses for Leftists (continued from Study 1 analyses) ***
sum II_scale if bloc_num==1, d /*median = .5625  */
gen II_left_high=1 if bloc_num==1 & II_scale> .5625
replace II_left_high=0 if bloc_num==1 & II_scale<= .5625 
tab II_left_high

ebalance II_left_high partisan_identity issues_aligned econ_aligned halacha_aligned age female relig_01 educ_01, targets(1)
svyset [pweight=_webal]
* Model 4 - Model 1 in Table 2
ologit intent_to_vote i.II_left_high
outreg2 using Table_D7.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

* Model 5 - Model 2 in Table 2
ologit polit_dis i.II_left_high
outreg2 using Table_D7.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

* Model 6 - Model 3 in Table 2
reg online_part i.II_left_high
outreg2 using Table_D7.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

** Matching for the experiment (result not shown in the main text) **
ebalance II_left_high issues_aligned econ_aligned halacha_aligned age female relig_01 educ_01, targets(1)
svyset [pweight=_webal]

* Anger 
svy: reg anger c.II_left_high##i.status_threat 
svy: reg anger c.II_left_high##i.status_threat c.issues_aligned##i.issue_threat
* Concern
svy: reg concern c.II_left_high##i.status_threat 
svy: reg concern c.II_left_high##i.status_threat c.issues_aligned##i.issue_threat
* Enthusiasm
svy: reg enthusiasm c.II_left_high##i.status_threat 
svy: reg enthusiasm c.II_left_high##i.status_threat c.issues_aligned##i.issue_threat



*** Table D9 - The abridged 4-item AIG scale ***

* Model 1 - Intention to vote in the next election
ologit intent_to_vote short_AIG_scale partisan_identity issues_aligned ///
econ_aligned halacha_aligned age female relig_01 educ_01, r
outreg2 using Table_D9.doc, replace se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

* Model 2 -  Political discussion with family and friends
ologit polit_dis short_AIG_scale partisan_identity issues_aligned ///
econ_aligned halacha_aligned age female relig_01 educ_01, r
outreg2 using Table_D9.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

* Model 3 - Online political participation
reg online_part short_AIG_scale partisan_identity issues_aligned ///
econ_aligned halacha_aligned age female relig_01 educ_01, r
outreg2 using Table_D9.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 


*** "Jackknifing" the Table 2 models ***
* Model 1 - Intention to vote in the next election
ologit intent_to_vote II_scale issues_aligned econ_aligned halacha_aligned ///
age female relig_01 educ_01, r
ologit intent_to_vote II_scale partisan_identity econ_aligned halacha_aligned ///
age female relig_01 educ_01, r
ologit intent_to_vote II_scale partisan_identity issues_aligned halacha_aligned ///
age female relig_01 educ_01, r
ologit intent_to_vote II_scale partisan_identity issues_aligned econ_aligned ///
age female relig_01 educ_01, r
ologit intent_to_vote II_scale partisan_identity issues_aligned econ_aligned ///
halacha_aligned female relig_01 educ_01, r
ologit intent_to_vote II_scale partisan_identity issues_aligned econ_aligned ///
halacha_aligned age relig_01 educ_01, r
ologit intent_to_vote II_scale partisan_identity issues_aligned ///
econ_aligned halacha_aligned age female educ_01, r
ologit intent_to_vote II_scale partisan_identity issues_aligned ///
econ_aligned halacha_aligned age female relig_01, r

* Model 2 -  Political discussion with family and friends
ologit polit_dis II_scale issues_aligned econ_aligned halacha_aligned ///
age female relig_01 educ_01, r
ologit polit_dis II_scale partisan_identity econ_aligned halacha_aligned ///
age female relig_01 educ_01, r
ologit polit_dis II_scale partisan_identity issues_aligned halacha_aligned ///
age female relig_01 educ_01, r
ologit polit_dis II_scale partisan_identity issues_aligned econ_aligned ///
age female relig_01 educ_01, r
ologit polit_dis II_scale partisan_identity issues_aligned econ_aligned ///
halacha_aligned female relig_01 educ_01, r
ologit polit_dis II_scale partisan_identity issues_aligned econ_aligned ///
halacha_aligned age relig_01 educ_01, r
ologit polit_dis II_scale partisan_identity issues_aligned econ_aligned ///
halacha_aligned age female educ_01, r
ologit polit_dis II_scale partisan_identity issues_aligned econ_aligned ///
halacha_aligned age female relig_01, r

* Model 3 - Online political participation
reg online_part II_scale issues_aligned econ_aligned halacha_aligned ///
age female relig_01 educ_01, r
reg online_part II_scale partisan_identity econ_aligned halacha_aligned ///
age female relig_01 educ_01, r
reg online_part II_scale partisan_identity issues_aligned halacha_aligned ///
age female relig_01 educ_01, r
reg online_part II_scale partisan_identity issues_aligned econ_aligned ///
age female relig_01 educ_01, r
reg online_part II_scale partisan_identity issues_aligned econ_aligned ///
halacha_aligned female relig_01 educ_01, r
reg online_part II_scale partisan_identity issues_aligned econ_aligned ///
halacha_aligned age relig_01 educ_01, r
reg online_part II_scale partisan_identity issues_aligned econ_aligned ///
halacha_aligned age female educ_01, r
reg online_part II_scale partisan_identity issues_aligned econ_aligned ///
halacha_aligned age female relig_01, r


***************
** Section E **
***************

*** Table E1 - Reactions to the Study 2 experiment ***

* Model 1 - Anger - with two interactions
reg anger c.II_scale##i.status_threat right_bloc i.issue_threat##c.issues_aligned ///
econ_aligned halacha_aligned age female relig_01 educ_01, r
outreg2 using Table_E1.doc, replace se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

* Figure E1 ('anger')
marhis II_scale, cate(status_threat) points (10) atmeans
graph save "anger_st2"
marhis issues_aligned, cate(issue_threat) points (10) atmeans
graph save "anger1_st2"

* Retrodesign estimate:
retrodesign  .5374672 , se(.1020677) alpha(0.05) df(689)

* Calculating the coefficient for the Ideo. Identity scale in a Status Threat condition in Model 1
reg anger status_threat II_scale statusthreat_II_scale right_bloc i.issue_threat##c.issues_aligned ///
econ_aligned halacha_aligned age female relig_01 educ_01, r
lincom II_scale + statusthreat_II_scale

* Calculating the coefficient for the Aligned Issue-based ideology in an Issue Threat condition in Model 1
reg anger status_threat II_scale statusthreat_II_scale right_bloc issue_threat issues_aligned ///
issuesthreat_issues_aligned econ_aligned halacha_aligned age female relig_01 educ_01, r
lincom issues_aligned + issuesthreat_issues_aligned


* Model 2 - Concern - with two interactions
reg concern c.II_scale##i.status_threat right_bloc i.issue_threat##c.issues_aligned ///
econ_aligned halacha_aligned age female relig_01 educ_01, r
outreg2 using Table_E1.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +) 

* Figure E1 ('concern')
marhis II_scale, cate(status_threat) points (10) atmeans
graph save "concern_st2"
marhis issues_aligned, cate(issue_threat) points (10) atmeans
graph save "concern1_st2"

* Retrodesign estimate:
retrodesign  .6413718 , se(.1093365) alpha(0.05) df(689)

* Calculating the coefficient for the Ideo. Identity scale in a Status Threat condition in Model 2
reg concern status_threat II_scale statusthreat_II_scale right_bloc i.issue_threat##c.issues_aligned ///
econ_aligned halacha_aligned age female relig_01 educ_01, r
lincom II_scale + statusthreat_II_scale

* Calculating the coefficient for the Aligned Issue-based ideology in an Issue Threat condition in Model 2
reg concern status_threat II_scale statusthreat_II_scale right_bloc issue_threat issues_aligned ///
issuesthreat_issues_aligned econ_aligned halacha_aligned age female relig_01 educ_01, r
lincom issues_aligned + issuesthreat_issues_aligned



* Model 3 - Enthusiasm - with two interactions
reg enthusiasm c.II_scale##i.status_threat right_bloc i.issue_threat##c.issues_aligned ///
econ_aligned halacha_aligned age female relig_01 educ_01, r
outreg2 using Table_E1.doc, append se dec(2) alpha (.001, .01, .05, .1) ///
symbol (***, **, *, +)

* Figure E1 ('enthusiasm')
marhis II_scale, cate(status_threat) points (10) atmeans
graph save "enthusiasm_st2"
marhis issues_aligned, cate(issue_threat) points (10) atmeans
graph save "enthusiasm1_st2"

* Combining the six graphs into Figure E1
grc1leg "anger_st2" "concern_st2" "enthusiasm_st2" "anger1_st2" "concern1_st2" "enthusiasm1_st2", legendfrom("anger_st2") colfirst col(2) ycommon
graph save "FigureE1", replace

erase "anger_st2.gph"
erase "anger1_st2.gph" 
erase "concern_st2.gph" 
erase "concern1_st2.gph" 
erase "enthusiasm_st2.gph" 
erase "enthusiasm1_st2.gph" 

* Retrodesign estimate:
retrodesign  -.5364485, se(.0812632) alpha(0.05) df(689)


* Calculating the coefficient for the Ideo. Identity scale in a Status Threat condition in Model 3
reg enthusiasm status_threat II_scale statusthreat_II_scale right_bloc ///
i.issue_threat##c.issues_aligned econ_aligned halacha_aligned age female relig_01 educ_01, r
lincom II_scale + statusthreat_II_scale

* Calculating the coefficient for the Aligned Issue-based ideology in an Issue Threat condition in Model 3
reg enthusiasm status_threat II_scale statusthreat_II_scale right_bloc issue_threat issues_aligned ///
issuesthreat_issues_aligned econ_aligned halacha_aligned age female relig_01 educ_01, r
lincom issues_aligned + issuesthreat_issues_aligned


